﻿
$(function () {
    JC.common.Utility.SetSidebar("JC_BillManage");

    GetInfos();

    $("#btnSearch").click(function () {
        GetInfos();
    });



});

function GetInfos() {
    var queryParam = {};
    queryParam.StartTime = $("#from").val();
    queryParam.EndTime = $("#to").val();
    queryParam.QueryKey = $("#queryKey").val();
    queryParam.PageIndex = JC.common.pageIndex;
    queryParam.PageSize = JC.common.pageSize;
    var url = $("#btnSearch").attr("data-url");
    $.ajax({
        type: "post",
        url: url,
        data: queryParam,
        dataType: "html",
        success: function (data) {
            $(".list").html(data);
            var count = $("#totalRecord").val();
            $("#divPager").paging(count, JC.common.pageSize, JC.common.pageIndex, JC.common.page_show_cnt);
        }
    });
}

$.subscribe('pageChanged', function (data) {
    //设置当前页
    JC.common.pageIndex = data.page;
    //根据分页参数查询数据
    GetInfos();
});

$(".list").on("click", ".updateRegister", function () {
    var url = $(this).attr("data-url")
    $.ajax({
        type: "post",
        url: url,
        async: false,
        dataType: "json",
        success: function (data) {
            if (data.error == 1) {
                alert(data.msg);
            } else {
                alert(data.msg);
            }
        }
    });
    GetInfos();
});

$(".list").on("click", ".updateValid", function () {
    var url = $(this).attr("data-url")
    $.ajax({
        type: "post",
        url: url,
        async: false,
        dataType: "json",
        success: function (data) {
            if (data.error == 1) {
                alert(data.msg);
            } else {
                alert(data.msg);
            }
        }
    });
    GetInfos();
});



function GetQueryModel() {
    var queryModel = {};
    queryModel.PageIndex = JC.common.pageIndex;
    queryModel.PageSize = JC.common.pageSize;
    queryModel.ClassIfyID = ClassIfyID;
    return queryModel;
}